dict_name = {"k1": "v1", "k2": "v2", "k3": "v3"}
print(dict_name.keys())
print(dict_name.values())
for k in dict_name.keys():
    print(k, dict_name[k])
dict_name.update({"k4": "v4"})
print(dict_name)

# 小明去超市购买水果
info = {}
info.update({"苹果": 32.8})
info.update({"香蕉": 22})
info.update({"葡萄": 15.5})
print(info)
fruits = input("请输入水果名称:")
print(info[fruits])
#
# 编写一个函数，传入一个列表，并统计每个数字出现的次数。返回字典数据：{21:3,56:9,10:3}names = [21, 21, 21, 56, 56, 56, 10, 10, 10]
num = [21, 21, 21, 56, 56, 56,56,56,56,56,56,56,56, 10, 10, 10]
num1 = {}
for i in num:
    if i not in num1:
        num1[i] = 1
    else:
        num1[i] += 1
print(num1)
names = [
    ["曹操", "56", "男", "106", "IBM", 500, "50"],
    ["大乔", "19", "女", "230", "微软", 501, "60"],
    ["小乔", "19", "女", "210", "Oracle", 600, "60"],
    ["许褚", "45", "男", "230", "Tencent", 700, "10"]
]
# 传入列表
num = [21, 21, 21, 56, 56, 56,56,56,56,56,56,56,56, 10, 10, 10]
num1 = {}
for i in num:
    if i not in num1:
        num1[i] = 1
    else:
        num1[i] += 1
print(num1)

# 有以下公司员工信息，将数据转换为字典方式（姓名作为键，其他作为值,张三:{xxx:xxx,xx:xxx}）
names_dic = {}
a = []
for i in range(len(names)):
    a.append(names[i][0])
    for x in a:
        names_dic[x] = names[i][1], names[i][2], names[i][3], names[i][4], names[i][5],names[i][6]
print(names_dic)
